/**
 * @format
 * @Author: TC
 * @Date: 2021-11-24 14:13:11
 * @Last Modified by: TC
 * @Last Modified time: 2022-03-05 18:36:11
 */

import { _decorator, Component, EventTouch, Node } from "cc";
import { app } from "../../FrameWork/App";
import { gameDataMgr } from "../_Common/Manager/GameDataManager";
import { nsBundleConst } from "../Const/BundleConst";
import { SceneAndWindowConst } from "../Const/SceneAndWindowConst";
import { GameTool } from "../Extend/GameTool";
const { ccclass, property } = _decorator;

@ccclass("Content")
export class OperatePanel extends Component {
    @property(Node)
    virualNode: Node = null; //虚拟键盘

    onLoad() {
        this.handleOperatePanel();
    }

    /**
     * 处理操作面板
     */
    private handleOperatePanel(): void {
        // if (ExtendFun.hasKeyboard()) {//电脑
        //     this.operateNode.destroy();
        // }
        // else {//移动端
        //     this.operateNode.active = true;
        // }
    }

    /**
     * 退出
     * @param e
     */
    onExit(e: EventTouch): void {
        GameTool.playButtonSound();
        app.sceneMgr.runScene(SceneAndWindowConst.MAIN_SCENE, nsBundleConst.Hall);
    }

    /**
     * 普攻
     * @param e
     */
    onAttack(e: EventTouch): void {
        gameDataMgr.entityHero.doAttack();
    }

    /**
     * 技能
     * @param e
     * @param data 索引
     */
    onSKill(e: EventTouch, data: string): void {
        let skillIndex = Number(data);
        gameDataMgr.entityHero.doSkill(skillIndex);
    }
}
